package com.bwie.controller;

import com.bwie.mapper.TbMenuMapper;
import com.bwie.service.TbUserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginVo;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.RegInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: badaotianqiong
 * @Date: 2025/7/18 14:24
 * @Description:
 **/
@RestController
@RequestMapping("/user/index")
public class AuthController {
    @Autowired
    private TbUserService tbUserService;


    @PostMapping("/sendCode/{mobile}")
    public R sendCode(@PathVariable("mobile") String mobile){
        return tbUserService.sendCode(mobile);
    }

    @PostMapping("/userReg")
    public R userReg(@RequestBody @Validated RegInfoVo regInfoVo){
        return tbUserService.userReg(regInfoVo);
    }

    @PostMapping("/userLogin")
    public R userLogin(@RequestBody @Validated LoginVo loginVo){
        return tbUserService.userLogin(loginVo);
    }

    @PostMapping("/getTreeList")
    public R getTreeList(){
        return tbUserService.getTreeList();
    }

    @PostMapping("getUserList")
    public R getUserList(@RequestBody PageInfoVo pageInfoVo){
        return tbUserService.getUserList(pageInfoVo);
    }

    @PostMapping("getUserInfoByUserId/{userId}")
    public R getUserInfoByUserId(@PathVariable("userId") Integer userId){
        return tbUserService.getUserInfoByUserId(userId);
    }
}
